/*
 * @Author: yxiawen
 * @Date: 2021-12-25 18:41:15
 * @LastEditTime: 2022-01-17 21:32:42
 * @LastEditors: yxiawen
 * @Description:
 * @FilePath: /vite-project/vite.config.js
 */
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
import { viteMockServe } from 'vite-plugin-mock';
import ViteRequireContext from '@originjs/vite-plugin-require-context'
import Components from "unplugin-vue-components/vite";
import path from "path";
import vueJsx from '@vitejs/plugin-vue-jsx'



// https://vitejs.dev/config/
export default defineConfig(({ command }) => {
  return {
    plugins: [
      vue(),
      vueJsx({}),
      Components({
        resolvers: [AntDesignVueResolver()]
      }),
      viteMockServe({
        supportTs: false,
        mockPath: 'mock',
        localEnabled: command === 'serve'
      }),
      ViteRequireContext()
    ],
    resolve: {
      alias: {
        "@": path.resolve(__dirname, "./src")
      }
    },
    cssPreprocessOptions: {
      javascriptEnabled: true
    }
  }
});
